/**
  * Author: Mei
  * Date: 2020-12-25 9:36
  * Description: 
  *
  */
#include <iostream>
#include <thread>
#include <vector>
#include <memory>

using namespace std;

vector<thread> g_list;
vector<shared_ptr<thread>> g_list2;

void func() {
    cout << "show time" << endl;
}

void createThread() {
    thread t(func);
    g_list.push_back(move(t));
    g_list2.push_back(make_shared<thread>(func));
}

int main() {
    createThread();

    for (auto &thread : g_list) {
        thread.join();
    }
    for (auto &thread : g_list2) {
        thread->join();
    }

    thread t(func);
    cout << "Current thread is id: " << t.get_id() << endl;
    cout << "cpu core: " << thread::hardware_concurrency() << endl;

    t.join();

    return 0;
}